﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using ThirdServices.AlertModel.Factory.Entities.DTO;
using ThirdServices.AlertModel.PressureSettings;

namespace ThirdServices.AlertModel.Analyzers
{
    class PressureAnalyser
    {
        public static List<BaseAlert> AnalysePressureData(List<PressureData> tempData, double delta,int periodInDays)
        {
            List<BaseAlert> baseAlerts = new List<BaseAlert>();
            for (int i = 0; i < tempData.Count; i++)
            {
                if (tempData[i].Pressure > delta)
                {
                    baseAlerts.Add(new BaseAlert
                                       {
                                           NotificationDescription = new NotificationDescription
                                                                         {
                                                                             alert_type =
                                                                                 AlertTypes.PressureAlert,
                                                                             notification =
                                                                                 Convert.ToString(tempData[i].Date,
                                                                                                  CultureInfo.
                                                                                                      InvariantCulture) +
                                                                                 " , " +
                                                                                 Convert.ToString(delta,
                                                                                                  CultureInfo.
                                                                                                      InvariantCulture) + "%"
                                                                         }
                                       });
                    break;
                }
            }
            return baseAlerts;
        }
    }
}
